<template>
	<div>
		<div class="LoginList">
			<el-form v-model="loginform" class="el-form">
				  <el-form-item style="width: 100px;">
				    <el-input v-model="loginform.username" placeholder="请输入用户名" style="width: 150px;"></el-input>
				  </el-form-item>
				  <el-form-item style="width: 100px;">
				    <el-input v-model="loginform.password" placeholder="请输入密码" style="width: 150px;"></el-input>
				  </el-form-item>
				  </el-form>
			<button @click="add" class="el-form">登录</button>
		</div>
	</div>
</template>

<script>
	export default {
		data(){
			return {
				loginform : {
					username : '',
					password : ''
				}
			}
		},
		methods:{
			add(){
				this.$axios.post('http://ceshi5.dishait.cn/admin/login',{
					username : this.loginform.username,
					password : this.loginform.password
				}).then(res => {
					var token = res.data.data.token
					localStorage.setItem("token",token)
					this.$router.push({
						path:'/About'
					})
				})
			}
		}
	}
</script>

<style scoped>
	.LoginList{
		width: 500px;
		height: 500px;
		border: 1px solid #B3C0D1;
		margin: 0 auto;
	}
	
	.el-form{
		margin-left: 180px;
	}
</style>
